<div class="row form-group">
    <div class="{{$viewClass['label']}} "><label class="control-label pull-right">{!! $label !!}</label></div>
    <div class="{{$viewClass['field']}}">
        @include('admin::form.error')

        <span name="{{$column}}"></span> {{-- 用于显示错误信息 --}}
        <div id="{{$column}}">
            <div class="{{$column}}-wrapper">
                <div class="{{$column}}-list">
                    @if(isset($data) && !empty($data))
                        @foreach($data as $pk => $da)
                            <div class="{{$column}}-item">
                        <div class="form-row mb-3">
                            <div class="col">
                                <div class="input-group">
                                    <div class="input-group-prepend">
                                        <div class="input-group-text">单词名称</div>
                                    </div>
                                    <input class="form-control" name="{{$column}}[{{$pk}}][name]" type="text" value="{{$da['name']}}">
                                    <div class="input-group-append">
                                        <button class="btn btn-outline-danger btn-outline-secondary {{$column}}-delete" type="button">
                                            删除
                                        </button>
                                    </div>
                                </div>
                                <div class="input-group">
                                    <div class="input-group-prepend">
                                        <div class="input-group-text">单词文案</div>
                                    </div>
                                    <input class="form-control" name="{{$column}}[{{$pk}}][word]" type="text" value="{{$da['word']}}">
                                </div>
                                <div class="input-group">
                                    <div class="input-group-prepend">
                                        <div class="input-group-text">图片上传</div>
                                    </div>
                                    <input type="button" id="loadFilePic_{{$pk}}" value="修改图片" onclick="document.getElementById('pic_{{$pk}}').click();" />
                                    <input type="file" style="display:none;" id="pic_{{$pk}}" name="{{$column}}[{{$pk}}][pic]" accept="image/*" value="{{$da['pic']}}"/>
                                    <input type="hidden" name="{{$column}}[{{$pk}}][pic]" value="{{$da['pic']}}"/>
                                </div>
                                <div class="input-group">
                                    <div class="input-group-prepend">
                                        <div class="input-group-text">音频上传</div>
                                    </div>
                                    <input type="button" id="loadFileXml_{{$pk}}" value="修改音频" onclick="document.getElementById('file_{{$pk}}').click();" />
                                    <input type="file" style="display:none;" id="file_{{$pk}}" name="{{$column}}[{{$pk}}][mp3]" accept="audio/*" value="{{$da['mp3']}}"/>
                                    <input type="hidden" name="{{$column}}[{{$pk}}][mp3]" value="{{$da['mp3']}}"/>
                                </div>
                                <div class="{{$column}}-sub-wrapper">
                                    <div class="form-row">
                                        <div class="{{$column}}-sub-list">
                                            @foreach($da['syllable'] as $p => $d)
                                                <div class="{{$column}}-sub-item form-row" data-key="{{$p}}">
                                                <div class="col">
                                                    <div class="input-group">
                                                        <div class="input-group-prepend">
                                                            <div class="input-group-text">音节文本</div>
                                                        </div>
                                                        <input class="form-control" name="{{$column}}[{{$pk}}][syllable][{{$p}}][text]" type="text" value="{{$d['text']}}">
                                                        <div class="input-group-prepend">
                                                            <div class="input-group-text">音节发音</div>
                                                        </div>
                                                        <input type="button" id="loadFileXml_{{$pk}}" value="修改音频" onclick="document.getElementById('file_{{$p}}').click();" />
                                                        <input type="file" style="display:none;" id="file_{{$p}}" name="{{$column}}[{{$pk}}][syllable][{{$p}}][pronunciation]" accept="audio/*"/>
                                                        <input type="hidden" name="{{$column}}[{{$pk}}][syllable][{{$p}}][pronunciation]" value="{{$d['pronunciation']}}"/>
                                                        <div class="input-group-append">
                                                            <button class="btn btn-outline-danger btn-outline-secondary {{$column}}-sub-delete" type="button">
                                                                删除
                                                            </button>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            @endforeach
                                        </div>
                                        <div class="col">
                                            <button class="btn btn-outline-primary {{$column}}-sub-add" data-key="{{preg_replace('/\D/s','',$pk)}}" data-key-sub-next="{{isset($da['syllable']) ? count($da['syllable']) : 2}}" type="button" style="font-size: xx-small">
                                                新增音节
                                            </button>
                                        </div>
                                    </div>
                                </div>

                            </div>
                        </div>
                    </div>
                        @endforeach
                    @endif
                </div>
                <div class="form-row">
                    <div class="col">
                        <button class="btn btn-outline-primary {{$column}}-add" data-key-next="{{isset($data) ? count($data) : 0}}" type="button">
                            新增单词
                        </button>
                    </div>
                </div>
            </div>
            <template id="{{$column}}-sub-template">
                <div class="{{$column}}-sub-item form-row" data-key="__KEY_SUB__">
                    <div class="col">
                        <div class="input-group">
                            <div class="input-group-prepend">
                                <div class="input-group-text">音节文本</div>
                            </div>
                            <input class="form-control" name="{{$column}}[new___KEY__][syllable][__KEY_SUB__][text]" type="text">
                            <div class="input-group-prepend">
                                <div class="input-group-text">音节发音</div>
                            </div>
                            <input class="form-control" name="{{$column}}[new___KEY__][syllable][__KEY_SUB__][pronunciation]" type="file" accept="audio/*">
                            <div class="input-group-append">
                                <button class="btn btn-outline-danger btn-outline-secondary {{$column}}-sub-delete" type="button">
                                    删除
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </template>
            <template id="{{$column}}-template">
                <div class="{{$column}}-item">
                    <div class="form-row mb-3">
                        <div class="col">
                            <div class="input-group">
                                <div class="input-group-prepend">
                                    <div class="input-group-text">单词名称</div>
                                </div>
                                <input class="form-control" name="{{$column}}[new___KEY__][name]" type="text">
                                <div class="input-group-append">
                                    <button class="btn btn-outline-danger btn-outline-secondary {{$column}}-delete" type="button">
                                        删除
                                    </button>
                                </div>
                            </div>
                            <div class="input-group">
                                <div class="input-group-prepend">
                                    <div class="input-group-text">单词文案</div>
                                </div>
                                <input class="form-control" name="{{$column}}[new___KEY__][word]" type="text">
                            </div>
                            <div class="input-group">
                                <div class="input-group-prepend">
                                    <div class="input-group-text">图片上传</div>
                                </div>
                                <input class="form-control" name="{{$column}}[new___KEY__][pic]" type="file" accept="image/*">
                            </div>
                            <div class="input-group">
                                <div class="input-group-prepend">
                                    <div class="input-group-text">音频上传</div>
                                </div>
                                <input class="form-control" name="{{$column}}[new___KEY__][mp3]" type="file" accept="audio/*">
                            </div>
                            <div class="{{$column}}-sub-wrapper">
                                <div class="form-row">
                                    <div class="{{$column}}-sub-list">__SUB_ITEM__</div>
                                    <div class="col">
                                        <button class="btn btn-outline-primary {{$column}}-sub-add" data-key="__KEY__" data-key-sub-next="2" type="button" style="font-size: xx-small">
                                            新增音节
                                        </button>
                                    </div>
                                </div>
                            </div>

                        </div>
                    </div>
                </div>
            </template>
        </div>
    </div>
</div>